import { notFound } from "next/navigation"; import type { ReactNode } from "react"; import { api } from "@/lib/api"; /** * Existence check outside the `loading.tsx` boundary so unknown sensor ids return a real 404 instead of a * 200 shell followed by the not-found UI (the page's own call is deduplicated by fetch memoization). */ export default async function SensorLayout({ params, children }: { params: Promise<{ id: string }>; children: ReactNode }) { const { id } = await params; if (!(await api.sensor(id))) notFound(); return children; }